/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package proyectoprogra3;

import java.awt.FlowLayout;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.LinkedList;
import javax.swing.*;


public class PJComboBox extends JPanel implements KeyListener{
    
    JTextField txtRapido;
    LinkedList<JTextField> jtext=new LinkedList<JTextField>();
    private JPanel pn;
    private JTextField texto;
    
    public PJComboBox() {
        this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        this.add(pn=new JPanel());
        pn.setLayout(new FlowLayout());
        txtRapido = new JTextField(30);
        jtext.add(txtRapido);
        pn.add(txtRapido);
        this.repaint();
        
        txtRapido.addKeyListener( this );
    }

    @Override
    public void keyTyped(KeyEvent e) {
        
    }

    @Override
    public void keyPressed(KeyEvent e) {
        switch(e.getKeyCode()){
                case KeyEvent.VK_ENTER:
                 this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        this.add(pn=new JPanel());
        pn.setLayout(new FlowLayout());
        txtRapido = new JTextField(30);
        jtext.add(txtRapido);
        pn.add(txtRapido);
       
    
       this.revalidate();
       this.repaint();
       
         
       
       
       // grupo = new ButtonGroup();
       // grupo.add(boton);
       
        //bt = new JButton("Agregar");
       // bt.setSize(30, 20);
       // this.setLayout(new FlowLayout());

        
    }
    }

    @Override
    public void keyReleased(KeyEvent e) {
       
    }
    
}

